import http from './http'
import { API_ENDPOINTS } from '@/api'

// 用户服务
export const userService = {
  // 登录
  login(data) {
    return http.post(API_ENDPOINTS.USER_LOGIN, data)
  },

  // 登出
  logout() {
    return http.post(API_ENDPOINTS.USER_LOGOUT)
  },

  // 获取用户信息
  getUserInfo() {
    return http.get(API_ENDPOINTS.USER_INFO)
  }
}

// 账户服务
export const accountService = {
  // 获取账户列表
  getList(params) {
    return http.get(API_ENDPOINTS.ACCOUNT_LIST, { params })
  },

  // 创建账户
  create(data) {
    return http.post(API_ENDPOINTS.ACCOUNT_CREATE, data)
  },

  // 更新账户
  update(id, data) {
    return http.put(`${API_ENDPOINTS.ACCOUNT_UPDATE}/${id}`, data)
  },

  // 删除账户
  delete(id) {
    return http.delete(`${API_ENDPOINTS.ACCOUNT_DELETE}/${id}`)
  }
}